//
//  UploadImageApi.m
//  pushNews
//
//  Created by Jobs on 4/15/17.
//  Copyright © 2017 Iori. All rights reserved.
//

#import "UploadNewsImageApi.h"

@implementation UploadNewsImageApi

-(NSString *)requestUrl
{
    return @"/api/upload_img";
}

-(id)requestArgument
{
    NSDictionary *param = @{@"member_id":self.member_id};
    return [self getAESCryptedWithParam:param];
}

-(AFConstructingBlock)constructingBodyBlock
{
    return ^(id<AFMultipartFormData> formData)
    {
        
        NSString *fileName = @"img";
        NSString *formKey = fileName;
        NSString *type = @"image/jpeg";
        if(self.image)
        {
            //            [formData appendPartWithFormData:UIImageJPEGRepresentation(self.entity.imgCard, 1) name:formKey];
            [formData appendPartWithFileData:UIImageJPEGRepresentation(self.image, .6)
                                        name:fileName fileName:formKey mimeType:type];
        }
    };
}

@end
